package com.piggy.logi.sys.controller;

import java.util.List;
import java.util.Arrays;

import lombok.RequiredArgsConstructor;

import javax.validation.constraints.*;

import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

import org.springframework.validation.annotation.Validated;
import com.piggy.common.log.annotation.Log;
import com.piggy.common.core.web.controller.BaseController;
import com.piggy.common.log.enums.BusinessType;
import com.piggy.logi.sys.vo.LogiWaybillReceiptLogVo;
import com.piggy.logi.sys.bo.LogiWaybillReceiptLogQueryBo;
import com.piggy.logi.sys.bo.LogiWaybillReceiptLogEditBo;
import com.piggy.logi.sys.service.ILogiWaybillReceiptLogService;
import com.piggy.common.core.utils.poi.ExcelUtil;
import com.piggy.common.core.web.page.TableDataInfo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import com.piggy.common.core.domain.R;

import java.lang.Integer;
import java.io.IOException;
import javax.servlet.http.HttpServletResponse;

/**
 * 运单回单跟踪信息Controller
 *
 * @author piggy
 * @date 2023-10-18
 */
@Api(value = "运单回单跟踪信息控制器", tags = {"运单回单跟踪信息管理"})
@RequiredArgsConstructor
@RestController
@RequestMapping("/sys/receiptlog")
public class LogiWaybillReceiptLogController extends BaseController {

    private final ILogiWaybillReceiptLogService iLogiWaybillReceiptLogService;

    /**
     * 查询运单回单跟踪信息列表
     */
    @ApiOperation("查询运单回单跟踪信息列表")
    //@SaCheckPermission("sys:log:list")
    @PostMapping("/list")
    public TableDataInfo<LogiWaybillReceiptLogVo> list(@RequestBody LogiWaybillReceiptLogQueryBo bo) {
        return iLogiWaybillReceiptLogService.queryPageList(bo);
    }

    /**
     * 删除运单回单跟踪信息
     */
    @ApiOperation("删除运单回单跟踪信息")
    //@SaCheckPermission("sys:log:remove")
    @Log(title = "运单回单跟踪信息", businessType = BusinessType.DELETE)
    @DeleteMapping("/{ids}")
    public R<Integer> remove(@NotEmpty(message = "主键不能为空")
                             @PathVariable Long[] ids) {
        return R.ok(iLogiWaybillReceiptLogService.deleteWithValidByIds(Arrays.asList(ids), true) ? 1 : 0);
    }
}
